import UsernameForm from "@/components/forms/form-types/username"
import PasswordForm from "@/components/forms/form-types/password"
import Email from "@/components/forms/form-types/email"
import Verify from "@/components/forms/form-types/verify"
import Phone from "@/components/forms/form-types/phone"

// eslint-disable-next-line react-refresh/only-export-components
export const FORM_TYPES = {
    USERNAME: "username",
    PASSWORD: "password",
    EMAIL: "email",
    PHONE: "phone",
    VERIFY: "verify",
} as const

export type FormType = (typeof FORM_TYPES)[keyof typeof FORM_TYPES]

interface FormFactoryProps {
    type: FormType
}

export const FormFactory = ({ type }: FormFactoryProps) => {
    switch (type) {
        case FORM_TYPES.USERNAME:
            return <UsernameForm />
        case FORM_TYPES.PASSWORD:
            return <PasswordForm />
        case FORM_TYPES.EMAIL:
            return <Email />
        case FORM_TYPES.VERIFY:
            return <Verify />
        case FORM_TYPES.PHONE:
            return <Phone />
        default:
            return null
    }
}
